/**
 * @Author: 耿立强
 * @Date: 2019/6/20
 * @Last Modified by:   耿立强
 * @Last Modified time: 2019-06-20 15:45:00
 */
import axios from '@/api/fetch';
import SERVER from '@/api/server';

// 车辆终身质保审核列表
export const vehicleWarrantyList = params => axios.get(`${SERVER.DMSCLOUD_ACTIVITY}/ttRpVehicleWarranty/vehicleWarrantyList`, { params });

export const getWarranty = params => axios.get(`${SERVER.DMSCLOUD_ACTIVITY}/ttRpVehicleWarranty/getWarranty/${params.warrantyId}`);

export const getVehicle = params => axios.get(`${SERVER.DMSCLOUD_ACTIVITY}/ttRpVehicleWarranty/getVehicle`, { params });

export const blackAudit = params => axios.post(`${SERVER.DMSCLOUD_ACTIVITY}/ttRpVehicleWarranty/blackAudit`, params);

//保存
export const addVehicleWarranty = params => axios.post(`${SERVER.DMSCLOUD_ACTIVITY}/ttRpVehicleWarranty/addVehicleWarranty`, params);

//批量驳回
export const blackAuditAll = params => axios.post(`${SERVER.DMSCLOUD_ACTIVITY}/ttRpVehicleWarranty/blackAuditAll`, params);

//更新数据
export const updatePara = params => axios.post(`${SERVER.DMSCLOUD_ACTIVITY}/ttRpThreeInfo/updatePara`, params);

//经销商列表查询
export const byAllInfo = params => axios.get(`${SERVER.CMSCLOUD_CHANNEL}/message/dealerAttach/dealerInfo/byAllInfo`);

//文件预览下载
export const downFile = params => {
  return axios({
    url: `${SERVER.DMSCLOUD_ACTIVITY}/ttRpVehicleWarranty/downFile`,
    method: 'get',
    params: params,
    responseType: 'blob'
  });
};

//文件预览下载
export const downExcel = params => {
  return axios({
    url: `${SERVER.DMSCLOUD_ACTIVITY}/ttRpVehicleWarranty/downExcel`,
    method: 'get',
    params: params,
    responseType: 'blob'
  });
};

//保存质保规则
export const addVehicleWarrantyRule = params => axios.post(`${SERVER.DMSCLOUD_ACTIVITY}/ttRpVehicleWarranty/addVehicleWarrantyRule`, params);

// 车辆终身质保规则列表
export const vehicleWarrantyRuleList = params => axios.get(`${SERVER.DMSCLOUD_ACTIVITY}/ttRpVehicleWarranty/vehicleWarrantyRuleList`, { params });

//质保规则录入 明细
export const getWarrantyRule = params => axios.get(`${SERVER.DMSCLOUD_ACTIVITY}/ttRpVehicleWarranty/getWarrantyRule/${params.warrantyRuleId}`);

// 特殊质保列表
export const vehicleSpecialWarrantyList = params => axios.get(`${SERVER.DMSCLOUD_ACTIVITY}/ttRpVehicleWarranty/vehicleSpecialWarrantyList`, { params });

//新增修改车辆特殊质保
export const addVehicleSpecialWarranty = params => axios.post(`${SERVER.DMSCLOUD_ACTIVITY}/ttRpVehicleWarranty/addVehicleSpecialWarranty`, params);

//删除车辆特殊质保
export const deleteVehicleSpecialWarranty = params => axios.post(`${SERVER.DMSCLOUD_ACTIVITY}/ttRpVehicleWarranty/deleteVehicleSpecialWarranty`, params);

//文件预览下载
export const downSpecialAdd = params => {
  return axios({
    url: `${SERVER.DMSCLOUD_ACTIVITY}/ttRpVehicleWarranty/downSpecialAdd`,
    method: 'get',
    params: params,
    responseType: 'blob'
  });
};

//文件预览下载
export const downSpecialDelete = params => {
  return axios({
    url: `${SERVER.DMSCLOUD_ACTIVITY}/ttRpVehicleWarranty/downSpecialDelete`,
    method: 'get',
    params: params,
    responseType: 'blob'
  });
};

//特殊质保质保录入 明细
export const getWarrantySpecialDetail = params => axios.get(`${SERVER.DMSCLOUD_ACTIVITY}/ttRpVehicleWarranty/getWarrantySpecialDetail/${params.specialWarrantyId}`);
